<template>
  <view class="">
    <view class="title">
      集电回路电缆选取推荐结果
    </view>
    <view class="content">
      <view class="">
        主干线截面积(mm2)
      </view>
      <view class="">
        {{loopNum}}
      </view>
    </view>
    <view class="content">
      <view class="">
        主干线导线型号推荐
      </view>
      <view class="">
        {{loopName}}
      </view>
    </view>
    <view class="content">
      <view class="">
        分支线截面积
      </view>
      <view class="">
        {{branchNum}}
      </view>
    </view>
    <view class="content">
      <view class="">
        分支线导线型号推荐
      </view>
      <view class="">
        {{branchName}}
      </view>
    </view>
    <view class="content">
      <view class="">
        地线型号推荐
      </view>
      <view class="">
        GJ-50
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        loopNum: '', // 主干截面
        branchNum: '', //分支界面
        region: '', // 地区
        loopName: '',
        branchName: '', // 分支 名称
        groundWireName: '', // 地线型号
      }
    },
    onLoad(event) {
      this.loopNum = event.loopNum
      this.branchNum = event.branchNum
      this.loopName = event.loopName
      this.branchName = event.branchName
      this.region = event.region
      this.setWindPowerInfo()
    },
    methods: {
      // 根据地区 查询 出 截面 对应的型号   1山区 代表 LGJ  2海上 JLLB20A
      setWindPowerInfo() {
        let specifications = ''
        if (this.region == 1) {
          specifications = 1
        } else if (this.region == 2) {
          specifications = 2
        }
        //  loop 代表 主干横截面
        this.getPowerChooseInfo(specifications, this.loopNum, 'loop');
        //  loop 代表 分支横截面
        this.getPowerChooseInfo(specifications, this.branchNum, 'branch');

        // this.getPowerChooseInfo(specifications, this.branchNum, 'groundWire');
      },
      getPowerChooseInfo(specifications, calculateSection, areaName) {
        let param = {
          specifications: specifications, //规格（1(LGJ) 2(JLLB20A)）3(地线)）',
          calculateSection: calculateSection, //计算截面
        }
        this.$u.api.specificationsModel.specificationsModelList(param)
          .then(res => {
            if (res.code != '200') return this.$u.toast(res.msg);
            if (areaName == 'loop') {
              this.loopName = res.rows[0].specificationsName
            } else if (areaName == 'branch') {
              this.branchName = res.rows[0].specificationsName
            }
          });
      }
    },
  }
</script>

<style lang="scss" scoped>
  .title {
    margin-top: 20px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
  }

  .content {
    margin: 20px;
    display: flex;
    justify-content: space-between;
  }
</style>
